home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10309 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: garden.csc.calpoly.edu!not-for-mail
  2. From: dstubbs@garden.csc.calpoly.edu (Dan Stubbs)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Example of an unintelligible program in C
  5. Date: 16 Mar 1996 10:16:36 -0800
  6. Organization: Cal Poly, San Luis Obispo
  7. Message-ID: <4if0i4$qsm@garden.csc.calpoly.edu>
  8. References: <4iegj7$evn@bee.uspnet.usp.br>
  9. NNTP-Posting-User: dstubbs@garden.csc.calpoly.edu
  10.  
  11. In article <4iegj7$evn@bee.uspnet.usp.br>,
  12. Carlos Eduardo Dantas de Menezes  <menezes@lsi.usp.br> wrote:
  13. >Please,
  14. >
  15. >Could someone give me an example of an (very)
  16. >unintelligible and short program in C?
  17. >This question is to show how shouldn't write a 
  18. >program in C (didatic purposes only).
  19. >Thank you very much!
  20. >
  21. >-- 
  22. >Carlos Eduardo Dantas de Menezes.
  23. >ESCOLA POLITECNICA DA UNIVERSIDADE DE SAO PAULO.
  24. >E-MAIL: menezes@lsi.usp.br
  25. >URL:    http://www.lsi.usp.br/~menezes/menezes.html
  26. >
  27. >
  28.  
  29. Here is one of my favorites. Guess what it does! Apply a formatter
  30. such as cb or indent to it if you really want to make it obscure.
  31.  
  32.                   int S(i){int O,o,I=i,l,_=0;while(I/=
  33.                  4)++_;for(l=(o=O=1<<_)<<_;o/=2;
  34.                 )if
  35.                ((I
  36.               =l+
  37.              (O+
  38. o+O<<       --_
  39.    ) )     <=i
  40.     ) O   |=o
  41.      , l  =I;
  42.       return
  43.        O ; }
  44.  
  45.